1. Technical Field
The present disclosure relates to device scanning and, particularly, to a scanning circuit and a scanning method thereof for a keyboard.
2. Description of Related Art
Referring to FIG. 1, a frequently used scanning circuit 100 used in a keyboard (not shown) usually includes sixteen keys. The scanning circuit 100 includes four rows R1˜R4 and four columns C1˜C4, constituting a switch matrix (not labeled) including sixteen intersections. Sixteen switches C1R1˜C4R4 are set at the intersections respectively, with two contacts of each switch electrically connected to a corresponding row and a corresponding column respectively, for example one contact of a switch C1R1 is electrically connected to a row R1 and the other contact of the switch C1R1 is electrically connected to a column C1. Each of the sixteen switches is normally open until a key is pressed, and then a corresponding switch, for example, C1R1, closes, and the row R1 and the column C1 are electrically connected. When the key is released, the corresponding switch opens. Furthermore, four input ports P1˜P4 are electrically connected to ends of the columns C1˜C4 respectively, and four output ports P5˜P8 are electrically connected to the rows R1˜R4 respectively. A power source is electrically connected to the other end of each column via a resistor.
During scanning, voltage of each input port P1˜P4 is sequentially set to low. When the voltage of one of the input ports P1˜P4 is set to low, the voltages of the remaining input ports P1˜P4 are set to high. The output ports are checked to determine whether any switches are closed, and thereby pressed keys corresponding to the switches can be identified.
As an example, if the voltage of the input port P1 electrically connected to the column C1 is set to be low, the voltage of the output port P5 electrically connected to the row R1 is also low, then the switch C1R1 is determined to be closed. Consequently, a pressed key corresponding to the switch C1R1 can be determined.
In practice, the input ports and the output ports are generally provided by a single-chip microprocessor. However, providing a microprocessor with so many ports is a waste.
Therefore, it is desirable to provide a scanning circuit and a scanning method capable of using fewer ports, which can overcome the limitations described.